<ui:composition
       xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"> 
<h:form>  
<p:growl id="messages" autoUpdate="true"/> 
      
<p:panelMenu  style="size: 5px;font-size: 12px;" >
    <p:submenu label="Elaboral Material" >
         <p:submenu styleClass="MenuEjercicio" label="Ejercicio CF" icon="ui-icon-extlink" style="size: 5px"  >  
                        <c:forEach items="#{tbCategoriaController.lstCategoria}" var="cxCat">
                            <p:submenu label="#{cxCat.descripcion}"  >
                                <c:forEach items="#{tbCategoriaController.getLstSubCategoria(cxCat)}" var="cxSubcat">
                                    <p:submenu label="#{cxSubcat.descripcion}" >
                                        <c:forEach items="#{tbCategoriaController.getLstTarea(cxSubcat)}" var="csTarea">
                                            <p:menuitem url="wFrmEjercicioCFNuevo.jsf" value="#{csTarea.descripcion}" icon="ui-icon-document"></p:menuitem>
                                        </c:forEach>
                                    </p:submenu>
                                </c:forEach>

                            </p:submenu>
                        </c:forEach>
                        
                    </p:submenu>  
          </p:submenu>
                    <p:submenu label="Realizar Entrenamiento" icon="ui-icon-extlink">  

                    </p:submenu>  


                    <p:submenu label="Actualizar Entrenamiento" icon="ui-icon-extlink">  

                    </p:submenu>  


                    <p:submenu label="Control de Avance" icon="ui-icon-extlink">  

                    </p:submenu>  


                    <p:submenu label="Seguridad" icon="ui-icon-extlink">  

                    </p:submenu>  

                </p:panelMenu>           
          
<script>
    $(function (){
        $('.MenuEjercicio').click(function(){
            if(0>document.location.href.search('wfrmEjercicioAdm.jsf')){
                document.location.href='wfrmEjercicioAdm.jsf';
            }
    });
    });
    </script>
<script>
 $(document).ready(function(){
  $(".ui-panelmenu-content").css("display","block"); //shows the menuitems
  $(".ui-panelmenu-header").addClass("ui-state-active"); //sets the submenu header to active state
  $(".ui-menuitem-content").css("display","block"); //shows the menuitems
  $(".ui-menuitem-header").addClass("ui-state-active"); //sets the submenu header to active state
  $(".ui-icon-triangle-1-e").removeClass("ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-s"); //sets the triangle icon to "expaned" state
});
    
</script>
</h:form>
</ui:composition>